package com.shop.dingdongshoppingapi.controller;

import com.shop.dingdongshoppingapi.entity.Foods;
import com.shop.dingdongshoppingapi.service.intf.FoodsService;
import com.shop.dingdongshoppingapi.vo.R;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/api/food/")
@Api
@CrossOrigin
public class FoodsController {
    @Autowired
    private FoodsService service;
    @GetMapping("queryfoods.do")
    public R queryFoods (int gid) {
        return service.queryFoods(gid);
    }
    @PostMapping("addcar.do")
    public R addCar (HttpServletRequest request, int num,int id) {
        return service.addCar(request.getIntHeader("ddstoken"),num,id);
    }
    @GetMapping("sel.do")
    public R sel (int id){
        return service.sel(id);
    }
}
